home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / tjgold.zip / INSTALL.003 / DEMIO1.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-29  |  4KB  |  102 lines

  1. {--------------------------------------------------------------------------}
  2. {                Product: TechnoJock's Turbo Toolkit GOLD                  }
  3. {                                                                          }
  4. {                     TTT GOLD - DEMO PROGRAM                        }
  5. {                                                                          }
  6. {                Copyright 1986-1995  TechnoJock Software, Inc.            }
  7. {                           All Rights Reserved                            }
  8. {                          Restricted by License                           }
  9. {--------------------------------------------------------------------------}
  10.  
  11. {Description: DEMIO1.PAS
  12.               Shows how to use a basic form to garner data from a user.
  13. }
  14.  
  15. Program DemIO1;
  16.  
  17. {$I GOLDFLAG.INC}
  18.  
  19. uses CRT, GoldAttr, GoldFast, GoldCal, GoldDate, GoldMisc, GoldKey, GoldIO,
  20.           GoldIO2, GoldStr;
  21.  
  22. var
  23.   Name,Tel:string;
  24.   Age:byte;
  25.   Sex: string[1];
  26.  
  27. procedure SetScreen;
  28. {}
  29. begin
  30.    SetBlinking(false);
  31.    Clear(LightRedOnCyan,'▒');
  32.    ClearLine(1,WhiteOnBlue);
  33.    WriteCenter(1,UseTint,'A Basic Input Form');
  34.    WriteAt(1,2,BlueOnYellow,replicate(80,'▀'));
  35.    WriteAT(70,2,WhiteOnBlack,'TTT Gold!');
  36.    Box3d(5,7,75,21,BlackOnLightGray,BlackOnLightGray,1);
  37.    ClearLine(25,YellowOnBlue);
  38. end; { SetScreen }
  39.  
  40. procedure SetVars;
  41. {Sets the default values for the fields}
  42. begin
  43.    Name := '';
  44.    Tel := '';
  45.    Age  := 0;
  46.    Sex := '';
  47. end; { SetVars }
  48.  
  49. procedure SetFields;
  50. {Defines the form by postioning the fields, linking the fields to
  51.  variables, and adding labels, hotkeys and messages}
  52. begin
  53.    {create the 5 fields}
  54.    KwikAddField(1, 25,9);      {Field 1, column 25, line 9}
  55.    KwikAddField(2, 25,11);      {Field 2, column 25, line 11}
  56.    KwikAddField(3, 25,13);      {Field 3, column 25, line 13}
  57.    KwikAddField(4, 25,15);     {Field 4, column 25, line 15}
  58.    KwikAddField(5, 26,18);     {Field 5, column 25, line 18}
  59.    {Note: when using the KwikAddxxx procedures, make sure that
  60.           the last field is always added with the procedure
  61.           KwikAddLastField}
  62.    KwikAddLastField(6, 43,18); {Field 6, column 43, line 18}
  63.    {now define the individual field properties}
  64.    {Field 1}
  65.    StringField(1, Name, '******************************'); {Field 1, use variable Name, accept any 30 characters}
  66.    SetLabel(1, LabelLeft,LabelLeft,'Full name:');
  67.    {Field 2}
  68.    StringField(2, Tel, '(###) ###-####'); {Field 2, use a format mask to define tel. field}
  69.    SetLabel(2, LabelLeft,LabelLeft,'Tel:');
  70.    {Field 3}
  71.    ByteField(3, Age, '##', 13,65);  {two digit number in the range 13 to 65}
  72.    SetLabel(3, LabelLeft,LabelLeft,'Patients age:');
  73.    {Field 4}
  74.    StringField(4, Sex, '!');  {single character field; force input to uppercase}
  75.    SetLabel(4, LabelLeft,LabelLeft,'Sex:');
  76.    {Fields 4 & 5: buttons}
  77.    ButtonField(5,'   OK   ',finished);
  78.    ButtonField(6,' Cancel ',escaped);
  79. end; { SetFields }
  80.  
  81. begin
  82. {$IFOPT D+}
  83.    HeapRecord;
  84. {$ENDIF}
  85.    SetScreen;
  86.    SetVars;
  87.    SetFields;
  88.    {by default each field is checked as the user tries to move from one field
  89.     to the next -- the following line instructs TTT to check it when OK is pressed}
  90.    SetValidation(ValidateAtEnd);
  91.    MouseShow(true);
  92.    ProcessInput(1);
  93.    GotoXY(1,25);
  94.    DisposeFields;
  95.    DisposeForms;
  96.    MouseShow(false);
  97.    Clear(LightGrayOnBlack,' ');
  98. {$IFOPT D+}
  99.    HeapCheck;
  100. {$ENDIF}
  101. end.
  102.